#include <stdio.h>
#include <string.h>
int i, j, len1, len2;
int next[101];
char s[101], t[101];
int main() 
{
    scanf("%s %s", s, t);
    len1 = strlen(s);
    len2 = strlen(t);
    i = 0;
    j = -1;
    next[0] = -1;
    while (i < len2) 
	{
        if (j == -1 || t[i] == t[j]) 
		{
            i++;
            j++;
            next[i] = j;
        } 
		else 
		{
            j = next[j];
        }
    }
    i = 0;
    j = 0;
    int cnt = 1;
    int flag = 0;
    while (i < len1) 
	{
        if (s[i] == t[j]) 
		{
            i++;
            j++;
            if (t[j] == '\0') 
			{
                flag = 1;
                break;
            }
        }
		else if (next[j] == -1) 
		{
            j = 0;
            i++;
            cnt++;
        } 
		else 
		{
            j = next[j];
            cnt++;
        }
    }
    if (flag) {
        printf("%d\n", cnt);
    } else {
        printf("0\n");
    }
    return 0;
}    
